Repository navigation
feat: support MCP protocol revision 2026-07-28 via the v2 TypeScript SDK - #156
Open
rbuchmayer-pplx wants to merge 1 commit into
Open
rbuchmayer-pplx wants to merge 1 commit into
rbuchmayer-pplx wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the server from the v1 MCP TypeScript SDK (
@modelcontextprotocol/sdk) to the v2 packages (@modelcontextprotocol/server,@modelcontextprotocol/node) and serves MCP protocol revision 2026-07-28 on both transports.The v1 SDK stops at revision 2025-11-25 and is in maintenance. A client that negotiates 2026-07-28 currently gets
400 Unsupported protocol versionon its first request and has to fall back toinitialize.What changed
serveStdio, so the opening exchange picks the revision per connection.isLegacyRequest:createMcpHandler.z.object(...)and tool handlers read the v2 request context (ctx.mcpReq).mcp-protocol-version,mcp-methodandmcp-namerequest headers, which 2026-07-28 clients send from browsers.zod^4.2.0(required by the v2 SDK),engines.node>=20.Behavior changes to be aware of
createPerplexityServerget a v2Server. Code that connects it to a v1 SDK transport needs to move to the v2 packages as well.-32602) instead of a tool result withisError: true. This comes from the SDK.tools/listoutput differs in two fields, both from the SDK: input schemas no longer setadditionalProperties: false, and tools no longer carryexecution.taskSupport. Tool names, descriptions, properties and output schemas are identical, and the server still ignores unknown arguments as before.Given the Node and library changes, this probably wants a major version bump. I left the version alone so that can go in the release PR.
Testing
npm test: 114 passing, including two new tests that connect a real client to the HTTP app, one negotiating 2026-07-28 and one opening withinitialize.mainand this branch side by side over HTTP:maininitialize(2025-11-25)tools/list(2025-11-25)server/discover(2026-07-28)tools/list(2026-07-28)perplexity_searchandperplexity_asksucceed over HTTP on both revisions. On 2026-07-28, progress notifications are delivered duringperplexity_ask.